//package com.li.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.CorsRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
//
//@Configuration
//public class WebMvcConfig extends WebMvcConfigurerAdapter {
//
////    磁盘映射
//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        //  /home/file/**为前端URL访问路径  后面 file:xxxx为本地磁盘映射 /tmp/javaUpload D://TEST/
//        registry.addResourceHandler("images/**").addResourceLocations("file:/tmp/javaUpload/");
//    }
//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//        registry.addMapping("/**")
//                //注意spring boot2.4以后是allowedOriginPatterns方法
//                .allowedOriginPatterns("*")
//                .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
//                .allowCredentials(true)
//                .maxAge(3600)
//                .allowedHeaders("*");
//    }
//}
